<template>
	<view>
		<view class="top" >
		<view class="card-avatar" :style="{backgroundColor:color}"></view>
		<view>{{names}}</view>
		</view>
		<!-- <view>
		<text>职称:{{position}}</text></view> -->
		<u-cell title="职称" :value=position></u-cell>
		<u-cell title="联系方式" :value=phone></u-cell>
		
		
		
	</view>
</template>

<script>
	import * as dd from 'dingtalk-jsapi';
	export default {
		data() {
			return {
				color:'#55aaff',
				names:'',
				loading: true,
				position:'',
				phone:'',
			}
		},
		methods: {
			
		},
		onLoad() {
					dd.getAuthCode({
									corpId: 'ding0a40cdce33c8deb624f2f5cc6abecb85',
									success: (res) => {
										    const {code}=res;
											
											uni.request({
												url:`http://localhost:8088/system/dingding/v2/user/${code}`,
												success:(res)=> {
													const{name}=res.data.result;
													const {title}=res.data.result;
													const{mobile}=res.data.result;
													
													this.names=name;
													
													this.position=title;
													this.phone=mobile;
													
												}
												
											})
													  },
								    fail: () => {uni.request({
												url:'http://localhost:8088/system/dingding/login',
												method:'GET'
											})},
									complete: () => {},
									});
				}
	}
</script>

<style>
		.container {
			padding: 20rpx 60rpx;
		}
	
		.userinfo {
			display: flex;
			flex-direction: column;
			align-items: center;
		}
	
		.userinfo-avatar {
			width: 128rpx;
			height: 128rpx;
			margin: 20rpx;
			border-radius: 50%;
		}
	
		.lists {
			margin: 10px 0;
		}
		.card-avatar {
  width: 60px;
  height: 60px;
  
  margin-right: 10px;
}
.top{
	display: flex;
}
</style>
